//
//  LzwArtTableCell.m
//  HalfsugarAPP
//
//  Created by 刘志武 on 15/12/31.
//  Copyright © 2015年 刘志武. All rights reserved.
//

#import "LzwArtTableCell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"
@interface LzwArtTableCell ()

@property (nonatomic, retain) LzwBaseImageView *myImageArt;
@property (nonatomic, retain) LzwBaseImageView *myImageArt1;
@property (nonatomic, retain) LzwBaseLable *myLableArt;
@property (nonatomic, retain) LzwBaseLable *myLableArt1;

@end


@implementation LzwArtTableCell

-(void)dealloc{
    [_myImageArt release];
    [_myImageArt1 release];
    [_myLableArt release];
    [_myLableArt1 release];
    [super dealloc];
}



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatArtView];
    }
    return self;
}

- (void)creatArtView{
    
    //图片
    self.myImageArt = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(2 * WIDTH, 2 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myImageArt.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myImageArt];
    
    //喜爱图片
    self.myImageArt1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myImageArt1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myImageArt1];
    
    //描述
    self.myLableArt = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLableArt.textColor = [UIColor lightGrayColor];
    self.myLableArt.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableArt.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableArt];
    
    //喜爱人数
    self.myLableArt1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLableArt1.textColor = [UIColor lightGrayColor];
    self.myLableArt1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableArt1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableArt1];
    
    
}

-(void)setModleArt:(LzwArtModle *)modleArt{
    
    if (_modleArt != modleArt) {
        [_modleArt release];
        _modleArt = [modleArt retain];
    }
    
    self.myLableArt.text = self.modleArt.title;
    self.myLableArt1.text = self.modleArt.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleArt.pic];
    
    [self.myImageArt sd_setImageWithURL:url placeholderImage:nil];
    
    
}
@end
